import { DataTypes, InferAttributes, InferCreationAttributes, Model, Sequelize } from 'sequelize'

export class SysUser extends Model<InferAttributes<SysUser>, InferCreationAttributes<SysUser>> {
  // id?: number
  // userName?: string
  // userPass?: string
  // userSort?: string

  static initModel(sequelize: Sequelize): typeof SysUser {
    return SysUser.init(
      {
        id: {
          autoIncrement: true,
          type: DataTypes.INTEGER,
          allowNull: false,
          primaryKey: true,
          field: 'id'
        },
        userName: {
          type: DataTypes.TEXT,
          allowNull: true,
          field: 'user_name'
        },
        userPass: {
          type: DataTypes.TEXT,
          allowNull: true,
          field: 'user_pass'
        },
        userSort: {
          type: DataTypes.INTEGER,
          allowNull: true,
          field: 'user_sort'
        }
      },
      {
        sequelize,
        tableName: 'sys_user',
        timestamps: false
      }
    )
  }
}
